<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>分类</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
  <link rel="stylesheet" href="../static/css/me.css">
  <link rel="icon" href="../static/favicon.ico">
</head>
<body>

  <!--导航-->
  <div th:replace="common/header :: menu(2)"></div>

  <!--中间内容-->
  <div  class="m-container-small m-padded-tb-big">
    <div class="ui container">
      <!--header-->
      <div class="ui top attached segment">
        <div class="ui middle aligned two column grid">
          <div class="column">
            <h3 class="ui teal header">分类</h3>
          </div>
          <div class="right aligned column">
            共 <h2 class="ui orange header m-inline-block m-text-thin" th:text="${types.size()}">  </h2> 个
          </div>
        </div>
      </div>

      <div class="ui attached segment m-padded-tb-large">
        <div class="ui labeled button  m-margin-tb-tiny" th:each="type:${types}">
          <a th:href="@{/types(type=${type.name})}" class="ui basic button" th:classappend="${active == type.name} ? 'teal'">[[${type.name}]]</a>
          <div class="ui basic left pointing label" th:classappend="${active == type.name} ? 'teal'">[[${type.typeCount}]]</div>
        </div>
      </div>

      <div class="ui top attached teal segment">
        <div class="ui padded vertical segment m-padded-tb-large m-mobile-lr-clear" th:each="blog:${pages.list}">
          <div class="ui mobile reversed stackable grid">
            <div class="eleven wide column">
              <h3 class="ui header"><a th:href="@{/blog(id=${blog.id})}" target="_blank">[[${blog.title}]]</a></h3>
              <p class="m-text line-limit-length">[[${blog.content}]]</p>
              <div class="ui stackable grid">
                <div class="eleven wide column">
                  <div class="ui mini horizontal link list">
                    <div class="item">
                      <img src="/static/images/profilePhoto.jpg" alt="" class="ui avatar image">
                      <div class="content"><a href="#" class="header">薄哥鸭</a></div>
                    </div>
                    <div class="item">
                      <i class="calendar icon"></i> [[${#dates.format(blog.creatTime,'yyy-MM-dd')}]]
                    </div>
                    <div class="item">
                      <i class="eye icon"></i> [[${blog.view}]]
                    </div>
                  </div>
                </div>
                <div class="right aligned five wide column">
                  <a th:href="@{/blog(id=${blog.id})}" target="_blank" class="ui teal basic label m-padded-tiny m-text-thin">认知升级</a>
                </div>
              </div>
            </div>

            <div class="five wide column">
              <a th:href="@{/blog(id=${blog.id})}" target="_blank">
                <img src="/static/images/profilePhoto.jpg" alt="" class="ui rounded image">
              </a>
            </div>

          </div>
        </div>
      </div>

      <div class="ui bottom attached segment">
        <div class="ui middle aligned two column grid">
          <div class="column">
            <a th:href="@{/types(page=${pages.hasPreviousPage}?${pages.prePage}:1,type=${param.type})}" class="ui mini teal basic button">上一页</a>
          </div>
          <div class="right aligned column">
            <a th:href="@{/types(page=${pages.hasNextPage}?${pages.nextPage}:${pages.pages},type=${param.type})}" class="ui mini teal basic button">下一页</a>
          </div>
        </div>
      </div>

    </div>
  </div>

  <br>
  <br>
  <!--底部footer-->
  <div th:replace="common/footer :: #footer"></div>

<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>

  <script>
    $('.menu.toggle').click(function () {
      $('.m-item').toggleClass('m-mobile-hide');
    });

  </script>
</body>
</html>